﻿<div class="spacing-bottom-sm row" page-header="Manage work orders">
    <div class="col-sm-3">
        <input class="form-control" ng-model="customer" placeholder="Customer" ui-keypress="{13:'search(customer)'}" autofocus
               typeahead-on-select="updateCustomer($item)" typeahead="customer as customer.name for customer in getCustomerList($viewValue)" />
    </div>
    <div class="col-sm-2">
        <input class="form-control" ng-model="filters.salesman" placeholder="Salesman name" type="text" ui-keypress="{13:'reSearch(customer)'}" />
    </div>
    <div class="col-sm-2">
        <a class="btn btn-info" ui-sref="workOrder-new" has-access="WOCreate">
            <b class="glyphicon glyphicon-plus"></b> New work order
        </a>
    </div>
</div>

<table ng-table="tableParams" class="table table-hover table-bordered " ng-visible="$data.length">
    <tr ng-repeat="item in $data">
        <td data-title="'WO#'" header-class="col-sm-1 width8"><span class="form-control-static">{{item.workOrderNo}}</span></td>
        <td data-title="'PO #'" header-class="col-sm-2 width9"><span class="form-control-static">{{item.poNumber}}</span></td>
        <td data-title="'Calib Date'" header-class="col-sm-1 width7"><span class="form-control-static">{{item.calibrationDate | date: 'dd/MMM/yyyy'}}</span></td>
        <td data-title="'Customer'" header-class="col-sm-3 width30>  <span class="form-control-static">  {{item.companyName}}</span></td>
        <td data-title="'Notes'" header-class="col-sm-3 width25"><span class="form-control-static text-left">{{item.note}}</span></td>
        <td data-title="'Units'" header-class="col-sm-3 width2"><span class="form-control-static text-right">{{item.totalUnit}}</span></td>
        <td data-title="'Salesman'" header-class="col-sm-2 width9"><span class="form-control-static">{{item.salesmanName}}</span></td>
        <td data-title="'Status'" header-class="col-sm-3 width5"><span class="form-control-static"> {{showStatus(item.status)}}</span></td>

        <td class="text-center" header-class="col-sm-1 width5">
            <a ui-sref="workOrder-item({id: item.workOrderId})" class="btn btn-default">View</a>
        </td>
    </tr>
</table>
<div ng-show="!tableParams.settings().$loading && tableParams.data.length === 0" class="well text-center">No result</div>
